package com.hkts.naturalgasauthentication.utils;

import com.hkts.management.common.utils.CustomPage;
import org.springframework.data.domain.Page;

/**
 * @ClassNameCustomPageUtil
 * @Description
 * @Author yck
 * @Date2021-03-02 16:47
 * @Version V1.0
 **/
public class CustomPageUtil {
    public static CustomPage getCustomPage(Page page){
        CustomPage customPagepage=new  CustomPage();
        customPagepage.setTotalRows(page.getTotalElements());
        customPagepage.setPageSize((long)page.getSize());
        customPagepage.setTotalPages((long)page.getTotalPages());
        customPagepage.setPageNumber((long)page.getNumber()+1);
        customPagepage.setResultData(page.getContent());
        return customPagepage;
    }
}
